; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=avr | FileCheck %s

define i8 @com8(i8 %x) {
; CHECK-LABEL: com8:
; CHECK:       ; %bb.0:
; CHECK-NEXT:    com r24
; CHECK-NEXT:    ret
  %neg = xor i8 %x, -1
  ret i8 %neg
}

define i16 @com16(i16 %x) {
; CHECK-LABEL: com16:
; CHECK:       ; %bb.0:
; CHECK-NEXT:    com r24
; CHECK-NEXT:    com r25
; CHECK-NEXT:    ret
  %neg = xor i16 %x, -1
  ret i16 %neg
}

define i32 @com32(i32 %x) {
; CHECK-LABEL: com32:
; CHECK:       ; %bb.0:
; CHECK-NEXT:    com r22
; CHECK-NEXT:    com r23
; CHECK-NEXT:    com r24
; CHECK-NEXT:    com r25
; CHECK-NEXT:    ret
  %neg = xor i32 %x, -1
  ret i32 %neg
}

define i64 @com64(i64 %x) {
; CHECK-LABEL: com64:
; CHECK:       ; %bb.0:
; CHECK-NEXT:    com r18
; CHECK-NEXT:    com r19
; CHECK-NEXT:    com r20
; CHECK-NEXT:    com r21
; CHECK-NEXT:    com r22
; CHECK-NEXT:    com r23
; CHECK-NEXT:    com r24
; CHECK-NEXT:    com r25
; CHECK-NEXT:    ret
  %neg = xor i64 %x, -1
  ret i64 %neg
}
